home *** CD-ROM | disk | FTP | other *** search
/ The X-Philes (2nd Revision) / The X-Philes Number 1 (1995).iso / xphiles / hp48hor1 / brix.doc < prev    next >
Text File  |  1995-03-31  |  12KB  |  183 lines

  1. Item: 752 by vervalin at AUSTIN.LOCKHEED.COM 
  2. Author: Documentation by Paul Vervalin; BRIX by Andreas Gustafsson. 
  3.   Subj: BRIX decoded 
  4.   Keyw: CHIP48 BRIX 
  5.   Date: Sat Sep 15 1990 09:57  
  6.  
  7. Below is a detailed description of the BRIX game that is run with the CHIP48 
  8. interpreter.  I hope this helps others when writing programs using CHIP48. 
  9. All of this is hand typed so please forgive me if there are any typos.  
  10. Happy programming!! 
  11.   
  12.   register          contents 
  13. ------------------------------------------------------ 
  14.     V0        scratch 
  15.     V1        scratch 
  16.     V2        scratch 
  17.     V3        X coordinate of score 
  18.     V4        Y coordinate of score 
  19.     V5        bricks hit counter 
  20.     V6        ball X coordinate 
  21.     V7        ball Y coordinate 
  22.     V8        ball X direction 
  23.     V9        ball Y direction 
  24.     VA        X coordinate when generating bricks 
  25.     VB        Y coordinate when generating bricks 
  26.     VC        paddle X coordinate 
  27.     VD        paddle Y coordinate 
  28.     VE        ball counter 
  29.     VF        collision detect 
  30.  
  31. address  instruction  code                      comment 
  32. ------------------------------------------------------------------------------- 
  33.  
  34.  
  35.   200      6E05      VE=05                     set # balls to 5 
  36.   202      6500      V5=00                     init. bricks hit to zero 
  37.   204      6B06      VB=06                     set Y position of first brick 
  38.   206      6A00      VA=00                     set X position of first brick 
  39.   208      A30C      I=30C                     set address of brick sprite 
  40.   20A      DAB1      DRAW VA VB 1 BYTE         draw brick sprite at loc. VA VB 
  41.   20C      7A04      VA=VA+4                   move along X to next brick loc. 
  42.   20E      3A04      IF VA=4 SKIP NEXT         if location wrapped goto next row 
  43.   210      1208      JUMP 208                  otherwise draw another 
  44.   212      7B02      VB=VB+2                   move down Y to next row 
  45.   214      3B12      IF VB=12 SKIP NEXT        if all rows drawn continue on 
  46.   216      1206      JUMP 206                  otherwise draw next row 
  47.   218      6C20      VC=20                     set X coordinate of paddle 
  48.   21A      6D1F      VD=1F                     set Y coordinate of paddle 
  49.   21C      A310      I=310                     get address of paddle sprite 
  50.   21E      DCD1      DRAW VC VD 1 BYTE         draw paddle at loc. VC VD 
  51.   220      22F6      GOSUB 2F6                 call subr. to output score    
  52.   222      6000      V0=00                     set X coord of balls remaining 
  53.   224      6100      V1=00                     set Y coord of balls remaining 
  54.   226      A312      I=312                     get address of balls sprite 
  55.   228      D011      DRAW V0 V1 1 BYTE         draw 4 of the five balls 
  56.   22A      7008      V0=V0+8                   set X to loc. of 5th ball sprite 
  57.   22C      A30E      I=30E                     get address of single ball sprite 
  58.   22E      D011      DRAW V0 V1 1 BYTE         draw 5th ball 
  59.   230      6040      V0=40                     set V0 to 40 for delay 
  60.   232      F015      DELAY TIMER = V0          set delay timer 
  61.   234      F007      V0 = DELAY TIMER          check status of delay timer 
  62.   236      3000      IF V0=00 SKIP NEXT        if delay timer zero continue 
  63.   238      1234      JUMP 234                  otherwise go check status again 
  64.   23A      C60F      V6=RANDOM AND 0F          get random X coord for ball start 
  65.   23C      671E      V7=1E                     set Y coord of ball start 
  66.   23E      6801      V8=01                     set X direction to the right 
  67.   240      69FF      V9=FF                     set Y direction to up 
  68.   242      A30E      I=30E                     get address of ball sprite 
  69.   244      D671      DRAW V6 V7 1 BYTE         draw ball at loc V6 V7 
  70.   246      A310      I=310                     get address of paddle sprite 
  71.   248      DCD1      DRAW VC VD 1 BYTE         draw paddle at loc. VC VD 
  72.   24A      6004      V0=04                     set V0 to 04 for key number 
  73.   24C      E0A1      IF KEY V0 NOT PRESSED SKIP NEXT  
  74.   24E      7CFE      VC=VC+FE                  set X coord to 2 to the left 
  75.   250      6006      V0=06                     set V0 to 06 for key number 
  76.   252      E0A1      IF KEY V0 NOT PRESSED SKIP NEXT 
  77.   254      7C02      VC=VC+2                   set X coord to 2 to the right 
  78.   256      603F      V0=3F                     set V0 right edge of screen 
  79.   258      8C02      VC=VC AND V0              wrap paddle around if needed 
  80.   25A      DCD1      DRAW VC VD 1 BYTE         draw paddle at loc. VC VD 
  81.   25C      A30E      I=30E                     get address of ball sprite 
  82.   25E      D671      DRAW V6 V7 1 BYTE         display ball at loc. V6 V7 
  83.   260      8684      V6=V6+V8                  move ball in X direction by V8 
  84.   262      8794      V7=V7+V9                  move ball in Y direction by V8 
  85.   264      603F      V0=3F                     set highest X coord. 
  86.   266      8602      V6=V6 AND V0              AND ball X pos. with V0 
  87.   268      611F      V1=1F                     set highest Y coord 
  88.   26A      8712      V7=V7 AND V1              AND ball Y pos. with V1 
  89.   26C      471F      IF V7 != 1F SKIP NEXT     if ball not at bottom skip 
  90.   26E      12AC      JUMP 2AC                  otherwise jump to 2AC 
  91.   270      4600      IF V6 != 00 SKIP NEXT     if ball not at left side, skip 
  92.   272      6801      V8=01                     else set X direction to right 
  93.   274      463F      IF V6 != 3F SKIP NEXT     if ball not at right side, skip 
  94.   276      68FF      V8=FF                     else set X direction to left 
  95.   278      4700      IF V7 != 00 SKIP NEXT     if ball not at top, skip 
  96.   27A      6901      V9=01                     else set Y direction down 
  97.   27C      D671      DRAW V6 V7 1 BYTE         draw ball at loc. V6 V7 
  98.   27E      3F01      IF VF = 1 SKIP NEXT       if there was a collision skip 
  99.   280      12AA      JUMP 2AA                  otherwise jump to 2AA 
  100.   282      471F      IF V7 != 1F SKIP NEXT     if ball not at bottom skip 
  101.   284      12AA      JUMP 2AA                  otherwise jump to 2AA 
  102.   286      6005      V0=05                     set V0 for 5 lines at screen top 
  103.   288      8075      V0=V0-V7                  check if ball was in this region 
  104.   28A      3F00      IF VF = 00 SKIP NEXT      if it was not then skip 
  105.   28C      12AA      JUMP 2AA                  otherwise jump to 2AA 
  106.   28E      6001      V0=01                     there was a collision 
  107.   290      F018      SOUND TIMER = V0          so beep 
  108.   292      8060      V0=V6                     get X coord of ball 
  109.   294      61FC      V1=FC                     compute postion of the brick 
  110.   296      8012      V0=V0 AND V1              that was hit 
  111.   298      A30C      I=30C                     get address of brick sprite 
  112.   29A      D071      DRAW V0 V7 1 BYTE         erase brick sprite by drawing 
  113.   29C      60FE      V0=FE                     reverse the Y direction of the 
  114.   29E      8903      V1=V1 XOR V0              ball sprite 
  115.   2A0      22F6      GOSUB 2F6                 call subr. to update score 
  116.   2A2      7501      V5=V5+1                   incr. bricks hit counter by one 
  117.   2A4      22F6      GOSUB 2F6                 call subr. to update score 
  118.   2A6      4560      IF V5 = 60 SKIP NEXT      if all bricks have been hit, skip 
  119.   2A8      12DE      JUMP 2DE                  else infinite loop (game over) 
  120.   2AA      1246      JUMP 246                  goto address 246 
  121.   2AC      69FF      V9=FF                     ball at bottom so set direct. up 
  122.   2AE      8060      V0=V6                     get X coord. of ball 
  123.   2B0      80C5      V0=V0-VC                  intersect with paddle 
  124.   2B2      3F01      IF VF = 01 SKIP NEXT      if intersect then skip 
  125.   2B4      12CA      JUMP 2CA                  otherwise goto 2CA 
  126.   2B6      6102      V1=02                     | 
  127.   2B8      8015      V0=V0-V1                  | 
  128.   2BA      3F01      IF VF = 1 SKIP NEXT       | 
  129.   2BC      12E0      JUMP 2E0                  | 
  130.   2BE      8015      V0=V0-V1                  | this portion determines the 
  131.   2C0      3F01      IF VF = 1 SKIP NEXT       | direction that the ball should 
  132.   2C2      12EE      JUMP 2EE                  | bounce. 
  133.   2C4      8015      V0=V0-V1                  | 
  134.   2C6      3F01      IF VF = 1 SKIP NEXT       | 
  135.   2C8      12E8      JUMP 2E8                  | 
  136.   2CA      6020      V0=20                     set beep delay       
  137.   2CC      F018      SOUND TIMER = V0          beep for lost ball 
  138.   2CE      A30E      I=30E                     get addres for ball sprite 
  139.   2D0      7EFF      VE=VE+FF                  remove one from ball count 
  140.   2D2      80E0      V0=VE                     set V0 to ball count 
  141.   2D4      8004      V0=V0+V0                  compute location of ball to erase 
  142.   2D6      6100      V1=00                     set Y coord. to top line 
  143.   2D8      D011      DRAW V0 V1 1 BYTE         erase ball from remaining 
  144.   2DA      3E00      IF VE = 00 SKIP NEXT      if no balls remain, skip 
  145.   2DC      1230      JUMP 230                  otherwise goto 230 
  146.   2DE      12DE      JUMP 2DE                  jump to end of game 
  147.   2E0      78FF      V8=V8+FF                  make ball go left 
  148.   2E2      48FE      IF V8 != FE SKIP NEXT     if ball was not going left, skip 
  149.   2E4      68FF      V8=FF                     else make it go left by 1 not 2 
  150.   2E6      12EE      JUMP 2EE                  goto paddle beep 
  151.   2E8      7801      V8=V8+1                   make ball go right 
  152.   2EA      4802      IF V8 != 2 SKIP NEXT      if ball was not going right, skip 
  153.   2EC      6801      V8=01                     else make it go right by 1 not 2 
  154.   2EE      6004      V0=04                     set beep time for paddle hit 
  155.   2F0      F018      SOUND TIMER = V0          turn on beep 
  156.   2F2      69FF      V9=FF                     set ball direction to up 
  157.   2F4      1270      JUMP 270                  goto 270 
  158.   2F6      A314      I=314                     set address to BCD score location 
  159.   2F8      F533      STORE BCD OF V5 IN I..I+2 store BCD of score 
  160.   2FA      F265      READ FROM I..I(V2)  
  161.   2FC      F129      I=5 BYTE SPRITE CHAR IN V1  get font for tens value from V1 
  162.   2FE      6337      V3=37                     set X coord. of score tens place 
  163.   300      6400      V4=00                     set Y coord of score 
  164.   302      D345      DRAW V3 V4 5 BYTES        draw tens place score # 
  165.   304      7305      V3=V3+5                   set X coord. of score ones place 
  166.   306      F229      I=5 BYTE SPRITE CHAR IN V2  get font for ones value from V2 
  167.   308      D345      DRAW V3 V4 5 BYTES        draw ones place score # 
  168.   30A      00EE      RETURN  
  169.   30C      E000                                brick sprite  
  170.   30E      8000                                ball sprite  
  171.   310      FC00                                paddle sprite  
  172.   312      AA00                                balls remaining sprite  
  173.   314      0000                                score storage  
  174.   316      0000                                score storage   
  175.                                                    _____        _______        
  176. *********************************    HP48SX       / ___ \      /__    (\      
  177. *                               * .----------.    ||   ||     /( _)  z) \    
  178. * Paul Vervalin                 * |]]]]]]].-.|    ||___||    |. V__ (_ \/|    
  179. *                               * |]]]]]]]| ||    \_____/    |   ( ) ) | |    
  180. * vervalin@AUSTIN.LOCKHEED.COM  * |]]]]]]]| ||   .-------.   [   |/  (_/ |   
  181. *                               * |]]]]]]]`-']---[ AMIGA ]__/ \  `.     /      
  182. ********************************* `----------'   `-------'     \_______/ 
  183.